package ace.tool.generate.code.impl.resolver.scheme.resolver.core;

import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.EntityClassInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.GraphqlAdminControllerClassInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.resources.GraphqlDtoFileInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.resources.GraphqlInputFileInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.test.TestGraphqlTestFileBundle;
import ace.tool.generate.code.impl.resolver.scheme.model.bo.core.test.graphql.*;
import ace.tool.generate.code.impl.resolver.scheme.model.dto.CommonInfo;
import ace.tool.generate.code.impl.resolver.scheme.model.dto.ProjectInfo;
import ace.tool.generate.code.impl.service.model.input.GenerateInput;
import lombok.Builder;
import lombok.RequiredArgsConstructor;

/**
 * @author caspar
 * @date 2023/11/17 10:34
 */
@Builder
@RequiredArgsConstructor
public class TestGraphqlTestFileBundleResolver {
  private final GenerateInput input;
  private final EntityClassInfo entityClassInfo;
  private final GraphqlAdminControllerClassInfo graphqlAdminControllerClassInfo;
  private final GraphqlDtoFileInfo graphqlDtoFileInfo;
  private final GraphqlInputFileInfo graphqlInputFileInfo;
  private final ProjectInfo coreProjectInfo;
  private final CommonInfo commonInfo;

  public TestGraphqlTestFileBundle resolve() {
    TestGraphqlTestAddFileInfo testGraphqlTestAddFileInfo = this.getTestGraphqlTestAddFileInfo();
    TestGraphqlTestGetFileInfo testGraphqlTestGetFileInfo = this.getTestGraphqlTestGetFileInfo();
    TestGraphqlTestListFileInfo testGraphqlTestListFileInfo = this.getTestGraphqlTestListFileInfo();
    TestGraphqlTestModifyFileInfo testGraphqlTestModifyFileInfo =
        this.getTestGraphqlTestModifyFileInfo();
    TestGraphqlTestRemoveFileInfo testGraphqlTestRemoveFileInfo =
        this.getTestGraphqlTestRemoveFileInfo();
    TestGraphqlTestRemoveLogicFileInfo testGraphqlTestRemoveLogicFileInfo =
        this.getTestGraphqlTestRemoveLogicFileInfo();
    TestGraphqlTestSaveFileInfo testGraphqlTestSaveFileInfo = this.getTestGraphqlTestSaveFileInfo();
    TestGraphqlTestSearchFileInfo testGraphqlTestSearchFileInfo =
        this.getTestGraphqlTestSearchFileInfo();
    return TestGraphqlTestFileBundle.builder()
        .entityModelId(entityClassInfo.getEntityModelId())
        .testGraphqlTestAddFileInfo(testGraphqlTestAddFileInfo)
        .testGraphqlTestGetFileInfo(testGraphqlTestGetFileInfo)
        .testGraphqlTestListFileInfo(testGraphqlTestListFileInfo)
        .testGraphqlTestModifyFileInfo(testGraphqlTestModifyFileInfo)
        .testGraphqlTestRemoveFileInfo(testGraphqlTestRemoveFileInfo)
        .testGraphqlTestRemoveLogicFileInfo(testGraphqlTestRemoveLogicFileInfo)
        .testGraphqlTestSaveFileInfo(testGraphqlTestSaveFileInfo)
        .testGraphqlTestSearchFileInfo(testGraphqlTestSearchFileInfo)
        .build();
  }

  private TestGraphqlTestSearchFileInfo getTestGraphqlTestSearchFileInfo() {
    return TestGraphqlTestSearchFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestSaveFileInfo getTestGraphqlTestSaveFileInfo() {
    return TestGraphqlTestSaveFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestRemoveLogicFileInfo getTestGraphqlTestRemoveLogicFileInfo() {
    return TestGraphqlTestRemoveLogicFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestRemoveFileInfo getTestGraphqlTestRemoveFileInfo() {
    return TestGraphqlTestRemoveFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestModifyFileInfo getTestGraphqlTestModifyFileInfo() {
    return TestGraphqlTestModifyFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestListFileInfo getTestGraphqlTestListFileInfo() {
    return TestGraphqlTestGetFileListInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestGetFileInfo getTestGraphqlTestGetFileInfo() {
    return TestGraphqlTestGetFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }

  private TestGraphqlTestAddFileInfo getTestGraphqlTestAddFileInfo() {
    return TestGraphqlTestAddFileInfoResolver.builder()
        .coreProjectInfo(coreProjectInfo)
        .entityClassInfo(entityClassInfo)
        .graphqlDtoFileInfo(graphqlDtoFileInfo)
        .graphqlAdminControllerClassInfo(graphqlAdminControllerClassInfo)
        .graphqlInputFileInfo(graphqlInputFileInfo)
        .build()
        .resolve();
  }
}
